var pageii = null;
var grid = null;
$(function() {
	grid = lyGrid({
		pagId : 'paging',
		l_column : [ {
			colkey : "id",
			name : "序号"
		}, {
			colkey : "material_code",
			name : "物料编码"
		}, {
			colkey : "oname",
			name : "名称"
		}, {
			colkey : "length",
			name : "长"
		}, {
			colkey : "weight",
			name : "宽"
		}, {
			colkey : "height",
			name : "高"
		}, {
			colkey : "unit",
			name : "单位"
		}, {
			colkey : "initialNumber",
			name : "初期结存数量"
		}, {
			colkey : "initialPrice",
			name : "平均单价"
		}, {
			colkey : "initialMoney",
			name : "初期结存金额"
		}, {
			colkey : "currentInNumber",
			name : "本期收入数量"
		}, {
			colkey : "currentInPrice",
			name : "平均单价"
		}, {
			colkey : "currentInMoney",
			name : "本期收入金额"
		}, {
			colkey : "currentOutNumber",
			name : "本期发出数量"
		}, {
			colkey : "currentOutPrice",
			name : "平均单价"
		}, {
			colkey : "currentOutMoney",
			name : "本期发出金额"
		}, {
			colkey : "lastNumber",
			name : "末期结存数量"
		}, {
			colkey : "lastPrice",
			name : "平均单价"
		}, {
			colkey : "lastMoney",
			name : "末期结存金额"
		}, {
			colkey : "checkNumber",
			name : "盘点数"
		}, {
			colkey : "profitAndLoss",
			name : "盈亏"
		} ],
		jsonUrl : rootPath
				+ '/warehousestock_form/warehousestock_form_findByPage.shtml',
		dymCol : true,
		checkbox : true,
		serNumber : false
	});
	$("#editFun").click("click", function() {
		editAccount();
	});
	$("#search").click("click", function() {//  绑定查询按扭

		var searchParams = $("#searchForm").serializeJson();
		grid.setOptions({
			data : searchParams
		});
	});

});
function editAccount() {
	var cbox = grid.getSelectedCheckbox();
	if (cbox.length > 1 || cbox == "") {
		layer.msg("只能选中一个");
		return;
	}
	pageii = layer.open({
		title : "编辑进销存报表",
		type : 2,
		area : [ "800px", "100%" ],
		content : rootPath
				+ '/warehousestock_form/warehousestock_form_edit.shtml?id='
				+ cbox
	});
}

